a85868c5b2322f3c2de012a51d9877649fdd31dc,source/jetbrains/mps/ide/ui/smodel/SModelTreeNode.java,MyModelListener,addAndRemoveVisibleChildren,#Set#Set#,295

Before Change


            SNode childNode = child.getSNode();
            int index = parentNode.getChildren().indexOf(childNode);
            if (index > indexof) { // insert added before it
              treeModel.insertNodeInto(new SNodeTreeNode(added, added.getRole_(), getOperationContext()),
                      parent, treeModel.getIndexOfChild(parent, child));
              continue outer;
            }

After Change


        treeModel.removeNodeFromParent(node);
      }

      outer : for (SNode added : addedNodes) {
        if (added.isDeleted()) continue;
        SNodeTreeNode parent = (SNodeTreeNode) findDescendantWith(added.getParent());
        if (parent == null) continue;
        if (!parent.isInitialized()) continue;
        SNode parentNode = parent.getSNode();
        int indexof = parentNode.getChildren().indexOf(added);
        for (Object childO : CollectionUtil.enumerationAsIterable(parent.children())) {
          if (childO instanceof SNodeTreeNode) {
            SNodeTreeNode child = (SNodeTreeNode) childO;
            SNode childNode = child.getSNode();
            int index = parentNode.getChildren().indexOf(childNode);
            if (index > indexof) { // insert added before it
              treeModel.insertNodeInto(createSNodeTreeNode(added, added.getRole_(), getOperationContext()),
                      parent, treeModel.getIndexOfChild(parent, child));
              continue outer;
            }